import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { DiceExpInfo } from "./info/DiceExpInfo";
type int = number;
//class DiceExpConfig
    
    export  class DiceExpConfig
    {
        constructor()
        {
            
            this._changeGold = new Map<any, any> /* flash.utils.Dictionary */();
            this._firExReward = new Map<any, any> /* flash.utils.Dictionary */();
            this._reward = new Map<any, any> /* flash.utils.Dictionary */();
            this._rewardEx = new Map<any, any> /* flash.utils.Dictionary */();
            if (DiceExpConfig._instance != null) 
            {
                throw new Error(" DiceExpConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_exp_dice_config.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            label313: for(loc2 of loc4) 
            {
                loc1 = new DiceExpInfo();
                loc1.id = loc2.id;
                loc1.intExtend1 = loc2.intExtend1;
                loc1.intExtend2 = loc2.intExtend2;
                loc1.num = loc2.num;
                loc1.type = loc2.type;
                loc1.value = loc2.value;
                var loc5=loc2.type;
                switch (loc5) 
                {
                    case "ExpDiceModifyGold":
                    {
                        this._changeGold[loc1.num] = loc1;
                        continue label313;
                    }
                    case "ExpDiceRewardEx":
                    {
                        this._firExReward[loc1.num] = loc1;
                        continue label313;
                    }
                    case "ExpDiceRewardExp":
                    {
                        this._reward[loc1.intExtend1 + "_" + loc1.num] = loc1;
                        continue label313;
                    }
                    case "ExpDiceRewardFullDice":
                    {
                        this._rewardEx[loc1.intExtend1 + "_" + loc1.num] = loc1;
                        continue label313;
                    }
                }
            }
            return;
        }

        public getFullDiceExp(arg1: string): int
        {
            var loc1=this._rewardEx[arg1] as DiceExpInfo;
            if (loc1) 
            {
                return loc1.value;
            }
            return 0;
        }

        public getYbEx(arg1: int): int
        {
            var loc1=0;
            if (arg1 > 0 && arg1 < 5 || arg1 == 0) 
            {
                loc1 = this._changeGold[arg1 + 1].value;
            }
            else if (arg1 >= 5) 
            {
                loc1 = this._changeGold[5].value;
            }
            return loc1;
        }

        public static get instance(): DiceExpConfig
        {
            if (DiceExpConfig._instance == null) 
            {
                DiceExpConfig._instance = new DiceExpConfig();
            }
            return DiceExpConfig._instance;
        }

        /* internal */ /* var */_changeGold: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_firExReward: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_reward: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_rewardEx: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: DiceExpConfig;
    }
